package sms;

import java.time.LocalDate;

public class Demo {
    public static void main(String[] args) {
        //test01();
        //test02();
        //test03();
        //test04();
        StudentManagementSystem sms = new StudentManagementSystem(6);
        //1.添加学生
        sms.addStudent(new PrimaryStudent(20241316,"小新",77,81
                , LocalDate.parse("2013-10-12"),"233434@qq.com"));
        sms.addStudent(new PrimaryStudent(20241327,"小明",95,88
                , LocalDate.parse("2014-11-12"),"233534@qq.com"));
        sms.addStudent(new PrimaryStudent(20241333,"花花",90,63
                , LocalDate.parse("2023-10-15"),"233434234344"));
        sms.addStudent(new PrimaryStudent(20241335,"天天",71,83
                , LocalDate.parse("2024-12-12"),"123123323@qq.com"));

        sms.showAllStudents();
        System.out.println(sms.randomRollCall());

    }

    private static void test04() {
        StudentManagementSystem sms = new StudentManagementSystem(6);
        sms.addStudent(new PrimaryStudent(20241316,"小新",77,81
                , LocalDate.parse("2013-10-12")));
        sms.addStudent(new PrimaryStudent(20241327,"小明",95,88
                , LocalDate.parse("2014-11-12")));
        sms.addStudent(new PrimaryStudent(20241333,"花花",90,63
                , LocalDate.parse("2023-10-15")));
        sms.addStudent(new PrimaryStudent(20241335,"天天",71,83
                , LocalDate.parse("2024-12-12")));
        Student[] studentsEnrolledBefore = sms.getStudentsEnrolledBefore("2023-11-01");
        sms.showAllStudents(studentsEnrolledBefore);

        System.out.println("--------------------------");

        Student[] studentsEnrolledAfter = sms.getStudentsEnrolledAfter("2014-11-12");
        sms.showAllStudents(studentsEnrolledAfter);
    }

    private static void test03() {
        StudentManagementSystem sms = new StudentManagementSystem(6);
        sms.addStudent(new MiddleStudent(20242477, "逍遥",
                88, 62, 90, 81));

        sms.addStudent(new MiddleStudent(20242489, "月如",
                99, 54, 76, 88));

        System.out.println(sms.contains(new MiddleStudent(20242489, "月如",
                99, 54, 76, 88)));

        System.out.println(sms.contains(new MiddleStudent(20242489, "灵儿",
                99, 54, 76, 88)));
    }

    private static void test02() {
        StudentManagementSystem sms = new StudentManagementSystem(6);
        sms.addStudent(new MiddleStudent(20242477, "逍遥",
                88, 62, 90, 81));

        sms.addStudent(new MiddleStudent(20242489, "月如",
                99, 54, 76, 88));

        sms.addStudent(new MiddleStudent(20242491, "灵儿",
                82, 49, 84, 92));

        sms.addStudent(new MiddleStudent(20242497, "唐钰",
                75, 63, 96, 100));

        System.out.println("----------------所有中学生信息-----------------");
        sms.showAllStudents();

        System.out.println("----------------中学生历史成绩平均分-----------------");
        System.out.println(sms.getAverageScoreBySubject("历史"));

        System.out.println("----------------按照总分排序后的中学生信息-----------------");
        sms.sortByTotalScore();//先针对数组从高到低排序
        sms.showAllStudents();//遍历数组

        System.out.println("----------------根据学生的学号查询学生信息-----------------");
        Student studentById = sms.findStudentById(20242491);
        System.out.println(studentById);
    }

    private static void test01() {
        StudentManagementSystem sms = new StudentManagementSystem(6);
        //1.添加学生
        sms.addStudent(new PrimaryStudent(20241316,"小新",77,81));
        sms.addStudent(new PrimaryStudent(20241327,"小明",95,88));
        sms.addStudent(new PrimaryStudent(20241333,"花花",90,63));
        sms.addStudent(new PrimaryStudent(20241335,"天天",71,83));

        System.out.println("----------------所有小学生信息-----------------");
        sms.showAllStudents();

        System.out.println("----------------获取小学生中数学最高成绩的学生信息-----------------");
        Student studentWithHighestScore = sms.findStudentWithHighestScore("数学");
        System.out.println(studentWithHighestScore);//toString方法会默认调用

        System.out.println("----------------获取小学生中语文最低成绩的学生信息-----------------");
        Student studentWithLowestScore = sms.findStudentWithLowestScore("语文");
        System.out.println(studentWithLowestScore);
    }
}
